{% extends "master.html" %} {% block content_header_title%}个人中心{% end %} {% block content_body%}
<div class="row">
    <div class="col-md-12">
        <div class="box box-primary">
            <div class="box-body">
                <!-- form start -->
                <form role="form" id="profile-form">
                    <div class="form-group">
                        <label for="user_login">账号</label>
                        <input type="text" class="form-control option" id="user_login" name="user_login" placeholder="账号" value="{{user.user_login}}" readonly>
                    </div>
                    <div class="form-group">
                        <label for="user_email">邮箱</label>
                        <input type="email" class="form-control option" id="user_email" name="user_email" placeholder="邮箱" value="{{user.user_email}}">
                    </div>
                    <div class="form-group">
                        <label for="user_nicename">昵称</label>
                        <input type="text" class="form-control option" id="user_nicename" name="user_nicename" placeholder="昵称" value="{{user.user_nicename}}">
                    </div>
                    <div class="form-group">
                        <label for="display_name">公开显示为</label>
                        <input type="text" class="form-control option" id="display_name" name="display_name" placeholder="公开显示为" value="{{user.display_name}}">
                    </div>
                    <div class="form-group">
                        <label for="description">个人说明</label>
                        <input type="text" class="form-control option" id="description" name="description" placeholder="个人说明" value="{{info['description']}}">
                    </div>
                    <div class="form-group">
                        <label for="gravatar">资料图片</label>
                        <input type="text" class="form-control option" id="gravatar" name="gravatar" placeholder="资料图片" value="{{info['gravatar']}}">
                    </div>
                    <div class="form-group">
                        <label for="new_pass">新密码</label>
                        <input type="password" class="form-control option" id="new_pass" name="new_pass" placeholder="新密码">
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="col-md-12">
        <button type="button" class="btn btn-primary pull-right" id="profile-btn">保存</button>
    </div>
</div>
{% end %} {% block footer%}
<script type="text/javascript">
    $(function() {
        $("#profile-btn").click(function() {
            var d = $("#profile-form").serialize();
            $.post('{{api("bo_profile_save")}}', d, function(rsp) {
                if (rsp.success) {
                    bo_alert_success("个人资料", "保存成功!")
                } else {
                    bo_alert_error("个人资料", "保存失败!")
                    bo_valid_errors("profile-form", rsp.data, rsp.message);
                }
            }, "json");
        });
    });
</script>
{% end %}